<?php
/**
    本版本修复问题如下：
    1.修复数据库无法重复创建问题
    2.新增记录用户查询记录核心代码（具体美化自己来
	  3.新增查看搜索记录
**/
    error_reporting(E_ALL^E_NOTICE); 
    include 'config.php';
    $adress = $_COOKIE['IpAddress'];  //get user's ipaddress;
		$ts = "ip:"+$adress+"用户插入的信息为:";
		$his = $_COOKIE['h'];
		$sql = "INSERT INTO xiaoxi (Id,host) VALUES ('$adress','$his')";  //插入
		$url="www.baidu.com/baidu?word=";
		$coo=$his;
		$all=$url.$coo;
		echo $all;
		$jumpurl=$all;
		$jumpcookie = SetCookie("jump",$jumpurl);
			if ($link->query($sql) === TRUE) {
    		echo "新记录插入成功";
			} else {
    		echo "Error: " . $sql . "<br>" . $link->error;
}
?>



 
<html>
	<head>
			 <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
			 <script type="text/javascript">
			 	function onload(){
			 		var strcookie=Cookies.get('jump');
			 		window.location.href="http://"+strcookie+"" ;
			 	}
			 </script>
	</head>
	<body onload="onload()">
	</body>
</html>
